package com.frxuexi.lib_base.room

import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
object DataModule {

    @Provides
    @Singleton
    fun initDataBase(@ApplicationContext context: Context):AppDataBase{
        return AppDataBase.init(context)
    }

    @Provides
    fun getUserDao(dataBase: AppDataBase):UserDao{
        return dataBase.userDao()
    }

    @Provides
    fun getAskDao(dataBase: AppDataBase):AskDao{
        return dataBase.askDao()
    }
}